#include <REGX52.H>
#include"Delay.H"



sbit RCK=P3^5; //重新定义为sbit，RCLK
sbit SCK=P3^6;// SRCLK
sbit SER=P3^4; //SER 

//unsigned char ByteN;  //lLED 测试中转数据

void _74HC59_WriteByte(unsigned char Byte)
{
	unsigned char i;
	for(i=0;i<8;i++) //用分号隔开  移位八次FOR循环
		
	{
		SER=Byte&(0x80>>i);  //非0即为真
		SCK=1;//上升沿
		SCK=0;//上升沿

	}
		RCK=1;//上升沿
		RCK=0;//上升沿
//		ByteN=Byte;
}	

 
void MatrixLED_showColum(unsigned char Column,Date)
{
//	if(Colum==0){P0=(~0X80);} //if 条件进行判断
//	if(Colum==1){P0=(~0X40);}
//	if(Colum==2){P0=(~0X20);}
//	if(Colum==3){P0=(~0X80);}
//	if(Colum==4){P0=(~0X80);}
	_74HC59_WriteByte(Date);
	P0=~(0X80>>Column);    //通过0X80来进行移位列 来实现
//	Delay(2)
//	P0=0X00;
}



void main()
{	
	SCK=0;
	RCK=0;

//	P2=ByteN;
	while(1)
	{
	MatrixLED_showColum(0,0X38);
	MatrixLED_showColum(1,0X00);
	MatrixLED_showColum(2,0X00);
	MatrixLED_showColum(3,0X00);
	MatrixLED_showColum(4,0X00);
	MatrixLED_showColum(5,0X00);
	MatrixLED_showColum(6,0X00);
	MatrixLED_showColum(7,0X00);
		                
	}
}